package com.fuze.domain.vo;

import com.fuze.domain.dto.AdministratorsDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;

/**
 * @author sepc_
 * @date 4/8/2021 09:25
 */
@ApiModel(value = "AdministratorsVO", description = "管理员视图对象")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AdministratorsVO implements Serializable {
    private static final long serialVersionUID = -4298317615478130509L;

    /**
     * 管理员用户的id
     */
    @ApiModelProperty(name = "id", value = "管理员用户的id")
    private Integer id;

    /**
     * 管理员的用户名
     */
    @ApiModelProperty(name = "username", value = "管理员用户的用户名", required = true)
    @NotBlank(message = "管理员用户名不能为空")
    private String username;

    /**
     * 管理员的密码
     */
    @ApiModelProperty(name = "password", value = "管理员用户的密码", required = true)
    @NotBlank(message = "管理员密码不能为空")
    private String password;

    /**
     * 装换成DTO对象
     *
     * @return 管理员的数据传输对象
     */
    public AdministratorsDTO toDTO() {
        AdministratorsDTO dto = new AdministratorsDTO();
        dto.setUsername(this.username);
        dto.setPassword(this.password);
        return dto;
    }
}
